#include "editorgallerygroup.h"

#include "../layouts/flowlayout.h"
#include "editorgalleryitem.h"
#include "gallerycommon.h"

using namespace core;
using namespace gui;

EditorGalleryGroup::EditorGalleryGroup(const QString& title,
    const QList<GalleryItem>& items,
    QWidget* parent) : QGroupBox(parent)
{
    FlowLayout* layout = new FlowLayout(this, PREFERRED_GAL_ITEM_PADDING,
        PREFERRED_GAL_ITEM_SPACING, PREFERRED_GAL_ITEM_SPACING);

    foreach (const GalleryItem& item, items)
    {
        layout->addWidget(new EditorGalleryItem(
            item.Thumbnail.GalleryRole, item.Label, item.Action,
            item.Thumbnail.DragAndDropRole, item.DragData));
    }

    setLayout(layout);
    setTitle(title);

    setSizePolicy(QSizePolicy::MinimumExpanding,
        QSizePolicy::Preferred);
}

EditorGalleryGroup::~EditorGalleryGroup()
{

}
